<?php
namespace Common\Model;
use Think\Model;

/**
 * 优惠券
 * Class DiscountCouponModel
 * @package Common\Model
 */
class StoreProductModel extends Model  {

    protected $tableName = 'b2c_store_product';
    public $local_id;

    public function __construct()
    {
        parent::__construct();
        $this->local_id = session('userInfo')['local_id'];
    }

    /**
     * 获取未过期的优惠券
     * @return mixed
     */
    public function getProduct($field = '*', $where){
//        'a.product_id,a.name,a.spec_info,b.store_pid'
//        ['b.store_pid' => ['in', $array_goods_id]]
        $products = M('b2c_products a')->field($field)
            ->join(C('DB_PREFIX') . 'b2c_store_product b on a.product_id=b.product_id', 'left')
            ->where($where)
            ->select();
        return $products;
    }


}